﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<meta name="GENERATOR" content="Microsoft FrontPage 12.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>WebNoteEditor</title>
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<style type="text/css">
#btnLock{
	border:0px;background-image:url('../images/locked.gif');background-repeat:no-repeat;width:11px;height:12px;cursor:hand;margin-right:20px
}
</style>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<script language="javascript" type="text/javascript" src="../script/ie2w3c-min.js"></script>
<script language="javascript" type="text/javascript">
var sizeLocked=true;
var selcssFilter=new EditorWindow._HTMLselect("selectcssFilter",document);
window.onload=function()
{

	renderWindowAsIE(window);
	
	if (XEditor.selectstatus==3)
		__first2preview();
	
	document.getElementById("btnLock").onclick=__btnLock_onclick;
	document.getElementById("inputWidth").onkeyup=function()
	{
		document.getElementById("inputWidth").value=parseInt(document.getElementById("inputWidth").value);
		if (sizeLocked)
		{
			if (!document.getElementById("inputWidth").value.isNumber())
			{
				document.getElementById("inputWidth").value="";
				document.getElementById("inputHeight").value="";
			}
			else
			{
				document.getElementById("inputHeight").value=parseInt(document.getElementById("inputWidth").value/document.getElementById("FirstIMG").width*document.getElementById("FirstIMG").height);
			}
				
		}
		__previewIt();
	}
	document.getElementById("inputHeight").onkeyup=function()
	{
		document.getElementById("inputHeight").value=parseInt(document.getElementById("inputHeight").value);	
		if (sizeLocked)
		{
			if (!document.getElementById("inputHeight").value.isNumber())
			{
				document.getElementById("inputHeight").value="";
				document.getElementById("inputWidth").value="";
			}
			else
			{
				document.getElementById("inputWidth").value=parseInt(document.getElementById("inputHeight").value/document.getElementById("FirstIMG").height*document.getElementById("FirstIMG").width);
			}
		}
		__previewIt();
	}
	
	var selcssFilter=new EditorWindow._HTMLselect("selectcssFilter",document);
	var sOptions=new Array(
				new Array("",EditorWindow.lang_none),
				new Array("Alpha(Opacity=50)",EditorWindow.lang_cssfilter_alphahalf),
				new Array("Alpha(Opacity=0, FinishOpacity=100, Style=1, StartX=0, StartY=0, FinishX=100, FinishY=140)",EditorWindow.lang_cssfilter_alphaline),
				new Array("blur(add=1,direction=14,strength=15)",EditorWindow.lang_cssfilter_blur),
				new Array("Wave(Add=0, Freq=60, LightStrength=1, Phase=0, Strength=3)",EditorWindow.lang_cssfilter_wave),
				new Array("gray",EditorWindow.lang_cssfilter_gray),
				new Array("Chroma(Color=#FFFFFF)",EditorWindow.lang_cssfilter_chroma),
				new Array("DropShadow(Color=#999999, OffX=7, OffY=4, Positive=1)",EditorWindow.lang_cssfilter_shadow),
				new Array("Shadow(Color=#999999, Direction=45)",EditorWindow.lang_cssfilter_glow),
				new Array("flipv",EditorWindow.lang_cssfilter_flipv),
				new Array("fliph",EditorWindow.lang_cssfilter_fliph),
				new Array("grays",EditorWindow.lang_cssfilter_grays),
				new Array("xray",EditorWindow.lang_cssfilter_xray),
				new Array("invert",EditorWindow.lang_cssfilter_invert)
				);

	selcssFilter.addOptions(sOptions,document);
	selcssFilter=null;
		
	document.getElementById("selectcssFilter").onchange=sel_cssfilter_onchange;
	document.getElementById("sel_file").onchange=sel_file_onchange;
	
	AutoResizeDialogWindow();

	if (parseInt(window.dialogWidth)>700)
	{
		window.dialogWidth="700px";
		window.dialogLeft=(window.screen.width/2-parseInt(window.dialogWidth)/2)+"px";
	}

}
function sel_cssfilter_onchange()
{
	var tempFilter;
	if (document.getElementById("PicShow").style.filter=="")
	{
		document.getElementById("PicShow").style.filter=document.getElementById("selectcssfilter").value;
	}
	else
	{
		tempFilter=document.getElementById("PicShow").style.filter.split(" ");
		if (EditorWindow.isRemoteFile(document.getElementById("PicShow").src))
			if (document.getElementById("selectcssfilter").value=="")
			{
				document.getElementById("PicShow").style.filter="";
			}
			else
			{
				document.getElementById("PicShow").style.filter=document.getElementById("selectcssfilter").value
			}
		else
			document.getElementById("PicShow").style.filter=tempFilter[0]+" "+document.getElementById("selectcssfilter").value
	}
	document.getElementById("inputcssText").value=document.getElementById("PicShow").style.cssText;
	//alert(document.getElementById("PicShow").style.filter);
}


function sel_file_onchange()
{
	var ExName,AllowEx;
	if (document.getElementById("sel_file").value!="")
	{
		ExName=EditorWindow.getFileExt(document.getElementById("sel_file").value);

		AllowEx=EditorWindow.$config.allow_upload_image_ext;
		
		document.getElementById("inputSrc").value=document.getElementById("sel_file").value;
		
		if (EditorWindow.$config.allow_upload_image_ext.isInArray(ExName))
		{
			document.getElementById("PicShow").src=document.getElementById("inputSrc").value;
			window.setTimeout("fixWH()",100);
			document.getElementById("PicShow").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image,src='"+document.getElementById("PicShow").src+"')";
			return;
		}
		
		document.getElementById("inputSrc").value="";
		alert(EditorWindow.tipsmsgReplace(EditorWindow.lang_tips_mediafileformaterror,"{0}|{1}",ExName+"|"+AllowEx));
	}
	
}

function fixWH()
{
		document.getElementById("PicShow").style.height=document.getElementById("PicShow").offsetHeight;
		document.getElementById("PicShow").style.width=document.getElementById("PicShow").offsetWidth;
		document.getElementById("PicShow").outerHTML=document.getElementById("PicShow").outerHTML;
		
		document.getElementById("FirstIMG").width=document.getElementById("inputWidth").value=parseInt(document.getElementById("PicShow").offsetWidth);
		document.getElementById("FirstIMG").height=document.getElementById("inputHeight").value=parseInt(document.getElementById("PicShow").offsetHeight);
		
		document.getElementById("PicShow").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='"+document.getElementById("PicShow").src+"')";
		
		/*设置图片不能超过一定宽高
		if (document.getElementById("PicShow").offsetWidth>380)
		{
			document.getElementById("PicShow").style.width="380px";
			document.getElementById("inputWidth").value="380";
			document.getElementById("inputHeight").value=parseInt(document.getElementById("inputWidth").value/document.getElementById("FirstIMG").width*document.getElementById("FirstIMG").height);
			document.getElementById("PicShow").style.height=document.getElementById("inputHeight").value+"px";
		}
		
		if (document.getElementById("PicShow").offsetHeight>380)
		{
			document.getElementById("PicShow").style.height="380px";
			document.getElementById("inputHeight").value="380";
			document.getElementById("inputWidth").value=parseInt(document.getElementById("inputHeight").value/document.getElementById("FirstIMG").height*document.getElementById("FirstIMG").width);
			document.getElementById("PicShow").style.width=document.getElementById("inputWidth").value+"px";
		}
		*/
}


function __btnOk_onclick()
{
	if (XEditor.selectstatus==3)
	{
		__preview2first();
		EditorWindow.PreviewAllLocalIMG();
	}
	else
	{
		PicShow.style.styleFloat=EditorWindow._FormgetRadioValue("align",document);
		EditorWindow.pasteHTML(PicShow.outerHTML.replace("id=PicShow",""));
	}
	window.close();
}

function __btnCancel_onclick()
{

	window.close();
}

function __previewIt()
{
	document.getElementById("PicShow").style.width=document.getElementById("inputWidth").value;
	document.getElementById("PicShow").style.height=document.getElementById("inputHeight").value;
	document.getElementById("PicShow").src=document.getElementById("inputSrc").value;
}


function __first2preview()
{
	document.getElementById("PicShow").src=XEditor.objselected.src;
	document.getElementById("FirstIMG").src=XEditor.objselected.src;
	document.getElementById("FirstIMG").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image,src='"+document.getElementById("FirstIMG").src+"')";
	
	document.getElementById("FirstIMG").style.width=document.getElementById("FirstIMG").offsetWidth;
	document.getElementById("FirstIMG").style.height=document.getElementById("FirstIMG").offsetHeight;
	//(document.getElementById("FirstIMG").offsetWidth+"\n"+document.getElementById("FirstIMG").offsetHeight);
	document.getElementById("inputSrc").value=document.getElementById("PicShow").src;
	document.getElementById("PicShow").style.cssText=XEditor.objselected.style.cssText;
	document.getElementById("inputcssText").value=XEditor.objselected.style.cssText;
	document.getElementById("PicShow").style.width=XEditor.objselected.clientWidth;
	document.getElementById("PicShow").style.height=XEditor.objselected.clientHeight;
	document.getElementById("inputWidth").value=XEditor.objselected.clientWidth;
	document.getElementById("inputHeight").value=XEditor.objselected.clientHeight;
	EditorWindow._FormfocusRadio("align",XEditor.objselected.style.styleFloat,document);
}

function __preview2first()
{
	XEditor.objselected.src=document.getElementById("PicShow").src;
	document.getElementById("FirstIMG").src=document.getElementById("PicShow").src;	
	XEditor.objselected.style.cssText=document.getElementById("PicShow").style.cssText;
	XEditor.objselected.style.styleFloat=EditorWindow._FormgetRadioValue("align",document);
	XEditor.objselected.outerHTML=XEditor.objselected.outerHTML;
}

function __btnLock_onclick()
{
	if (sizeLocked)
	{
		document.getElementById("btnLock").style.backgroundImage="url('../images/unlocked.gif')";
	}
	else
	{
		document.getElementById("btnLock").style.backgroundImage="url('../images/locked.gif')";
	}
	sizeLocked=!sizeLocked;
}


</script>
</head>
<body class="dialog">
<script language="javascript" type="text/javascript">dialogTitle("lang_attribute_image")</script>

<table border="0" width="580" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="middle">
    	<fieldset><legend><script language="javascript" type="text/javascript">dialogPrintlang("lang_preview")</script></legend>
    	<div style="width:360px;height:330px;overflow: auto;">
			<img src="../images/image.loading.gif" id="PicShow" alt="">
      	</div>
      	</fieldset>
    </td>
    <td style="padding-left: 10px;vertical-align:top">
      <table border="0" width="280" cellspacing="0" cellpadding="0">
        <tr>      
	      <td class="subtitle"><script language="javascript" type="text/javascript">dialogPrintlang("lang_url")</script></td>      
	      <td colspan="3" class="hr" width="266">       
	            <hr size="1" color="#B3AC9D">      
	      </td>      
        </tr>  
        <tr>
	      <td colspan="4"  style="padding-left:20"> 
	      <input size="28" readonly="readonly" id="inputSrc" class="dialogInput" style="position: relative;z-index: 1;height:20;margin-bottom:-1px; left: 0px; top: -5px; width: 190px;">
	      <input id="sel_file" type="file" class="SysBTN5" size="0" style="margin-left:-20px; z-index: 0;position: relative;top:-4px;left:0">      
	      </td>      
        </tr>      
        <tr>      
	      <td class="subtitle"><script language="javascript" type="text/javascript">dialogPrintlang("lang_layout")</script></td>      
	      <td colspan="3" class="hr" width="266">       
	            <hr size="1" color="#B3AC9D">      
	      </td>      
        </tr>      
        <tr>      
            
			<td colspan="4" align="center" width="327">       
			  <INPUT name="align" type=radio value=""><script language="javascript" type="text/javascript">dialogPrintlang("lang_default")</script>     
			  <INPUT name="align" type=radio value="left"><script language="javascript" type="text/javascript">dialogPrintlang("lang_align_left")</script>       
			  <INPUT name="align" type=radio value="right"><script language="javascript" type="text/javascript">dialogPrintlang("lang_align_right")</script>     
			</td>      
        </tr>      
        <tr>      
			<td class="subtitle"><script language="javascript" type="text/javascript">dialogPrintlang("lang_size")</script></td>          
			<td colspan="3" class="hr" width="266">           
			    <hr size="1" color="#B3AC9D">      
			</td>          
        </tr>      
        <tr>      
                
		    <td align="right" width="59"><script language="javascript" type="text/javascript">dialogPrintlang("lang_width")</script></td>          
		    <td width="93">           
		      <input size="6" maxlength="5" id="inputWidth" class="dialogInput">px
		    </td>    
		    <td width="16" rowspan="2">
				<img alt="" src="../images/lock_line.gif" width="10" height="21">
			</td>
		    <td width="102" rowspan="2">           
				<div id="btnLock"></div>		    
		    </td>          
        </tr>      
        <tr>      
                
		    <td align="right" width="59"><script language="javascript" type="text/javascript">dialogPrintlang("lang_height")</script></td>          
		    <td width="93">
		    	<input size="6" maxlength="5" id="inputHeight" class="dialogInput">px           
		    </td>    
        </tr>      
        <tr>      
			<td class="subtitle"><script language="javascript" type="text/javascript">dialogPrintlang("lang_cssfilter")</script></td>          
			<td colspan="3" class="hr" width="266">           
			    <hr size="1" color="#B3AC9D">      
			</td>          
        </tr>      
        <tr>      
	      <td colspan="4" class="hr" width="327">
	        <table border="0" cellpadding="0" cellspacing="0" width="100%">      
	          <tr>      
	            <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_effect")</script></td>         
	            <td><select id="selectcssFilter"></select></td>         
	          </tr>         
	          <tr>      
	            <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_css_csstext")</script></td>         
	            <td><input size="41" id="inputcssText" style="font-size: 9pt; border-style: inset; border-width: 1"> </td>         
	          </tr>       
	        </table>         
	           
	      </td>              
        </tr>  
        <tr>      
	      <td colspan="4" class="hr" width="327" align="right">
				<hr size="1" color="#B3AC9D">
		    	<script language="javascript" type="text/javascript">
		    		PrintButtons2();
		    	</script>
	      </td>              
        </tr> 
      </table>         
    </td>         
  </tr>         
</table>
<img id="FirstIMG" style="visibility:hidden" alt="">
</body>
</html>
